<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="menu" content="mainMenu" />
<meta name="nav" content="0" />
<meta name="acc" content="0" />
<title>部门管理</title>
<script type="text/javascript"
	src="<c:url value='/ext/ui/jquery-ui-1.8.12.custom.min.js'/>"></script>
<link href="${ctx}/styles/lightness/jquery-ui-1.8.12.custom.css"
	rel="stylesheet" />
<script type="text/javascript">
	$(document).ready(function(){
		$("#adddept").click(
				function() {
					var url = "${ctx}/project/sign/org/department!input.action?organizationId=${organizationId}&projectId=${projectId}&typeId=${typeId}&deptId=${deptId}";
				    mm = showDialogWindow(url);
						if (mm != null) {
							if ($.browser.msie) {
								document.getElementById("deptMan").click();																    		   
				    		}else{
								window.location.reload();										
				    		}
						}
				});
			$("#cloBtn").click(function(){
				window.close();
			});	
	});
	function deleteDept(url){
		$.ajax({ url: url, context: document.body, dataType:'text', success: function(msg){
			if("1"==msg){
				if ($.browser.msie) {
					document.getElementById("deptMan").click();																    		   
	    		}else{
					window.location.reload();										
	    		}
			}else{
				alert("系统出错!");
			}
		}});				
	}	
	function updateDept(url){
			 mm =showDialogWindow(url);
			 if(mm){
				 $("#reload")[0].click();
			 }
	}
</script>
</head>
<body>
<form id="mainForm" action="department.action" method="post"
	class="yform"><input type="hidden" name="page.pageNo"
	id="pageNo" value="${page.pageNo}" /> <input type="hidden"
	name="page.orderBy" id="orderBy" value="${page.orderBy}" /> <input
	type="hidden" name="page.order" id="order" value="${page.order}" />
<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all ui-sortable">
	<c:if test="${typeId == '1' }">
	<li><a id="build" class="ui-state-default ui-corner-top "
		href="${ctx}/project/sign/build!input.action?projectId=${projectId}&contractKind=${typeId}&decorator=${param.decorator}&confirm=${param.confirm}&signid=${signid}">单位信息</a></li>
	</c:if>
	<c:if test="${typeId != '1' }">
	<li><a id="build" class="ui-state-default ui-corner-top "
		href="${ctx}/project/org/organization!input.action?id=${organizationId}&projectId=${projectId}&typeId=${typeId}&deptId=${deptId}&decorator=${param.decorator}&confirm=${param.confirm}&signid=${signid}">单位信息</a></li>
	</c:if>
	<li><a class="ui-state-default ui-corner-top"
		href="${ctx}/project/org/qualification.action?organizationId=${organizationId}&projectId=${projectId}&typeId=${typeId}&deptId=${deptId}&decorator=${param.decorator}&confirm=${param.confirm}&signid=${signid}">单位资质</a></li>
	<li><a id="deptMan" class="ui-state-default ui-corner-top  ui-tabs-selected ui-state-active"
		href="${ctx}/project/sign/org/department.action?deptId=${deptId}&projectId=${projectId}&typeId=${typeId}&organizationId=${organizationId}&decorator=${param.decorator}&confirm=${param.confirm}&signid=${signid}">部门设置</a></li>
	<li><a class="ui-state-default ui-corner-top " href="${ctx}/project/sign/org/userdepartment.action?organizationId=${organizationId}&projectId=${projectId}&typeId=${typeId}&deptId=${deptId}&decorator=${param.decorator}&confirm=${param.confirm}&signid=${signid}">人员情况</a></li>
</ul>
<div id="message"><s:actionmessage theme="custom"
	cssClass="success" /></div>
<div id="content">
<table id="contentTable">
	<tr>
		<th><a href="javascript:sort('depName','asc')">部门名称</a></th>
		<th><a href="javascript:sort('depType','asc')">机构类别</a></th>
		<th>总负责人</th>
		<th>职工人数</th>
		<th>操作</th>
	</tr>
	<c:forEach items="${page.result}" var="dept">
		<tr>
			<td>${dept.depName}&nbsp;</td>
			<td><pt:code category="3008" code="${dept.depType}"></pt:code>&nbsp;</td>
			<td>${dept.burderMan}&nbsp;</td>
			<td>${dept.staffers}&nbsp;</td>
			<td>&nbsp;
			<a href="#" onclick="updateDept('${ctx}/project/sign/org/department!input.action?id=${dept.id}&organizationId=${dept.organization.id}&projectId=${projectId}&typeId=${typeId}&deptId=${deptId}')">修改</a>&nbsp; 
			<a href="#" onclick="deleteDept('${ctx}/project/sign/org/department!deleteDept.action?id=${dept.id}&organizationId=${dept.organization.id}&projectId=${projectId}&typeId=${typeId}&deptId=${deptId}');">删除</a></td>
			<a id="reload" href="${ctx}/project/sign/org/department.action?organizationId=${organizationId }&projectId=${projectId}&typeId=${typeId }&deptId=${deptId }&decorator=${param.decorator}&confirm=${param.confirm}"></a>
		</tr>
	</c:forEach>
</table>
</div>
<div class="type-button"><input id="adddept"
	 type="button" class="submit" value="新增" /> 
	<c:if test="${fn:length(param.decorator)==0}">
		<input id="cloBtn"  type="button"   value="关闭" class="reset"/>
	</c:if>
</div>
</div>
</form>
</body>
</html>
